// 获取星期几
export const getWeekday = (dateString: string): string => {
  const weekdays = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']
  const date = new Date(dateString)
  const weekday = weekdays[date.getDay()]
  return weekday ?? '星期日'
}

// 格式化日期为 YYYY-MM-DD
export const formatDate = (dateString: string): string => {
  const date = new Date(dateString)
  const year = date.getFullYear()
  const month = String(date.getMonth() + 1).padStart(2, '0')
  const day = String(date.getDate()).padStart(2, '0')
  return `${year}-${month}-${day}`
}
